Skip to content

GT-3013 Add Lessons dashboard personalization#4416

Merged
frett merged 8 commits into
developfrom
dashboardPersonalizationLessons
May 8, 2026
Merged

GT-3013 Add Lessons dashboard personalization#4416
frett merged 8 commits into
developfrom
dashboardPersonalizationLessons

Conversation

@frett

@frett frett commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a segmented toggle to LessonsLayout letting users switch between a personalized view and all lessons, gated behind a Firebase Remote Config flag
  • Introduces LessonsFlowProducer to supply the lesson list based on the selected mode (country-personalized with language fallback, or all lessons sorted by default order)
  • Updates the header title to reflect the active mode (distinct strings for personalized vs. all lessons)
  • Syncs personalized tool order via GodToolsSyncService.syncToolOrder whenever the selected locale changes

Test plan

  • LessonsLayoutTest — toggle visibility, toggle click events, lesson card click
  • LessonsPresenterTest — mode state, persistence through save/restore, lessons filtered by mode, sync task registration/locale/force
  • LessonsFlowProducerTest — flow produces correct lessons per mode, hidden lesson filtering, fallback behavior
  • Paparazzi snapshots for Personalization, All Lessons, and Personalization Disabled variants

🤖 Generated with Claude Code

@frett frett force-pushed the dashboardPersonalizationLessons branch from 1b989bb to d4870c1 Compare May 7, 2026 18:15
@codecov

codecov Bot commented May 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.27778% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.99%. Comparing base (bb822f8) to head (b431c27).

Files with missing lines Patch % Lines
.../godtools/ui/dashboard/lessons/LessonsPresenter.kt 84.84% 0 Missing and 5 partials ⚠️
...cru/godtools/ui/dashboard/lessons/LessonsLayout.kt 92.85% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4416      +/-   ##
===========================================
+ Coverage    51.76%   51.99%   +0.22%     
===========================================
  Files          453      454       +1     
  Lines        12014    12075      +61     
  Branches      2079     2092      +13     
===========================================
+ Hits          6219     6278      +59     
  Misses        5181     5181              
- Partials       614      616       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@frett frett force-pushed the dashboardPersonalizationLessons branch 2 times, most recently from 17daeaa to e6313df Compare May 7, 2026 18:52
@frett frett changed the title Add personalization toggle to Lessons dashboard page Add Lessons dashboard personalization May 7, 2026
frett and others added 8 commits May 7, 2026 14:36
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mirrors the personalization toggle added to ToolsLayout — adds Mode,
isPersonalizationEnabled, and eventSink to LessonsPresenter.UiState,
reads the remote config flag, and shows a segmented button toggle at
the top of the lessons list when personalization is enabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Loads lessons based on the current mode: PERSONALIZATION uses
getPersonalizedLessonsFlow with the country from Settings, falling back
to language-only when no country-specific results exist; ALL_LESSONS
uses getLessonsFlowByLanguage. Both modes filter hidden lessons.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@frett frett force-pushed the dashboardPersonalizationLessons branch from 7181988 to b431c27 Compare May 7, 2026 20:36
@frett frett marked this pull request as ready for review May 7, 2026 20:42
@frett

frett commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

PR Review: dashboardPersonalizationLessons

8 commits · Lessons dashboard personalization feature

Summary

Adds a personalization toggle to the Lessons dashboard that lets users switch between a country-personalized view and an all-lessons view. Introduces LessonsFlowProducer as a dedicated flow provider, wires LessonsPresenter to a sync task registry via CircuitContext, and covers everything with unit, presenter, and Paparazzi snapshot tests.


Checklist Findings

✅ Looks Good

  • ktlint — clean pass, no violations
  • Circuit patternsUiState/UiEvent properly nested in LessonsPresenter; UiEvent is internal sealed interface; eventSink exposed on UiState; UI delegates through state.eventSink(UiEvent.*) exclusively
  • @ConsistentCopyVisibility + internal constructor on UiState — correct Kotlin 2 idiom; prevents external modules from constructing or copy()-ing state
  • LessonsFlowProducer extraction — clean separation; flow logic moved out of the presenter correctly
  • rememberSaveable for mode — survives process death; state restoration test verifies this
  • CircuitContext as @Assisted — correct pattern for accessing registry in a presenter; factory updated to match
  • DisposableEffect for sync task lifecycle — properly registers/unregisters on locale change
  • modifier: Modifier = Modifier — present on all composable entry points (LessonsLayout, PersonalizationToggle, LessonsHeader)
  • Theme / colors — no per-module theme introduced; existing MaterialTheme usage unchanged
  • String resources — old dashboard_lessons_header_title key renamed to _personalized in all 24 locale files; new _all, toggle_* keys added to base only (expected — translations go through the localization pipeline)
  • No unrelated formatter churn — stat confirms only intentional changes
  • Test coverageLessonsFlowProducerTest (pure JVM), LessonsPresenterTest (Robolectric + Circuit test API), LessonsLayoutTest (Compose UI, v2 runComposeUiTest)
  • Paparazzi — snapshots not recorded locally; old snapshot files removed, new ones committed via CI workflow

⚠️ Minor Issues

  • LessonsFlowProducer.kt:28,32 — Nested lambdas both use implicit it, shadowing the outer it:
    .map { it.sortedBy { it.defaultOrder } }   // line 28
    // ...
    baseFlow.map { it.filterNot { it.isHidden } }  // line 32
    Shadowing is valid Kotlin and ktlint doesn't flag it, but naming the outer parameter (tools ->) would make the type clearer at a glance. Low priority.

❌ Must Fix

(none)


Overall Verdict

APPROVE

A clean, well-structured feature. Good separation of concerns with LessonsFlowProducer, correct Circuit patterns throughout, solid test coverage across all three layers, and proper encapsulation with @ConsistentCopyVisibility. The only note is a cosmetic lambda naming nit in LessonsFlowProducer that isn't worth holding up the PR.

🤖 Generated with Claude Code

@frett frett requested a review from tjohnson009 May 7, 2026 20:49
@frett frett enabled auto-merge May 7, 2026 21:04
@frett frett changed the title Add Lessons dashboard personalization GT-3013 Add Lessons dashboard personalization May 7, 2026

@tjohnson009 tjohnson009 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very similar to the previous one for tools, which makes sense.

@frett frett merged commit ea1ac31 into develop May 8, 2026
13 checks passed
@frett frett deleted the dashboardPersonalizationLessons branch May 8, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants